package com.peter.proxy.hkgolden.data;

/**
 *
 */
//public class ContentProvider {
//
//	protected static final Logger log = LoggerFactory
//			.getLogger(ContentProvider.class);
//
//	public static Collection<Topic> createTopics(InputStream inputStream)
//			throws IOException {
//		return null;
//	}
//
//	public static Collection<Topic> createTopics() throws IOException,
//			JSONException {
//
//		Injector injector = Guice.createInjector(new ApplicationModule());
//		HttpService httpService = injector.getInstance(HttpService.class);
//
//		final String jsonData = httpService.getFromUrl(new URL(
//				"http://api.hkgolden.com/topics.aspx" + "?returntype=json"
//						+ "&page=1" + "&pagesize=30" + "&type=BW"));
//		log.trace("jsonData.length() = {}", jsonData.length());
//		if (jsonData.length() > 0) {
//			// Create JSONObject object
//			final JSONObject jsonObj = new JSONObject(jsonData);
//			// Extract list of topics and create JSONArray object
//			final JSONArray topicsList = jsonObj.getJSONArray("topic_list");
//			// Print details of each topic
//			final HashSet<Topic> topics = new HashSet<Topic>();
//			for (int i = 0; i < topicsList.length(); i++) {
//				// Get a topic
//				final JSONObject topic0 = topicsList.getJSONObject(i);
//				// Print message title
//				Topic topic = new Topic();
//				topic.setId(topic0.getLong("Message_ID"));
//				topic.setTitle(topic0.getString("Message_Title"));
//			}
//			return topics;
//		}
//		return null;
//	}
//	//
//	// public static Collection<Reply> createReplies(InputStream inputStream)
//	// throws IOException {
//	// final Source source = JerichoHtmlHelper.newFormattedSource(inputStream);
//	//
//	// final List<Element> replyElements = source.getAllElements(
//	// Constants.TAG_ID, Constants.REGEX_THREAD);
//	// final HashSet<Reply> replies = new HashSet<Reply>(replyElements.size());
//	// for (Element replyElement : replyElements) {
//	// replies.add(ReplyParser.parse(replyElement));
//	// }
//	// return replies;
//	// }
// }
